 文本事件input,focus,blur,change

 <!DOCTYPE html>
 <html>
 <head>
 	<title></title>
 </head>
 <body>
 	<input type="" style="" name="">
 	<input type="" name="" value="输入用户名" style="color: red" onfocus="if(this.value == '输入用户名'){this.value = '';this.style.color = '#424242'} " onblur="if (this.value == '') {this.value = '输入用户名'}">
 </body>
 </html>

 <script type="text/javascript">
 	var input = document.getElementsByTagName('input')[0];
 	input.oninput = function (e) {
 		console.log(this.value)
 	}
 	var input = document.getElementsByTagName('input')[0];
 	input.onchange = function (e) {//比较聚焦前后变化
 		console.log(this.value)
 	}
 </script>